package org.jeecg.modules.pipe.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.vo.SelectTreeModel;
import org.jeecg.modules.pipe.entity.Section;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.pipe.vo.PipeMarkerVo;
import org.jeecg.modules.pipe.vo.PipeQueryVo;

import java.util.List;

/**
 * @Description: 管网管段
 * @Author: jeecg-boot
 * @Date:   2024-05-14
 * @Version: V1.0
 */
public interface ISectionService extends IService<Section> {

    /**根节点父ID的值*/
    public static final String ROOT_PID_VALUE = "0";

    /**树节点有子节点状态值*/
    public static final String HASCHILD = "1";

    /**树节点无子节点状态值*/
    public static final String NOCHILD = "0";

    /**
     * 新增节点
     *
     * @param section
     */
    void addSection(Section section);

    /**
     * 修改节点
     *
     * @param section
     * @throws JeecgBootException
     */
    void updateSection(Section section) throws JeecgBootException;

    /**
     * 删除节点
     *
     * @param id
     * @throws JeecgBootException
     */
    void deleteSection(String id) throws JeecgBootException;

    /**
     * 查询所有数据，无分页
     *
     * @param queryWrapper
     * @return List<Section>
     */
    List<Section> queryTreeListNoPage(QueryWrapper<Section> queryWrapper);

    /**
     * 【vue3专用】根据父级编码加载分类字典的数据
     *
     * @param parentCode
     * @return
     */
    List<SelectTreeModel> queryListByCode(String parentCode);

    /**
     * 【vue3专用】根据pid查询子节点集合
     *
     * @param pid
     * @return
     */
    List<SelectTreeModel> queryListByPid(String pid);


    PipeMarkerVo getPipeMarkNode(String id);

    void saveSection(Section section);

    /**
     * 获取管段marker
     * @param queryVo
     * @return
     */
    List<PipeMarkerVo> getSectionMarker(PipeQueryVo queryVo);

    /**
     * 获取管网marker
     * @param queryVo
     * @return
     */
    List<PipeMarkerVo> getPipeMarker(PipeQueryVo queryVo);

    /**
     * 管网关阀-下流影响演示
     * @param queryVo
     * @return
     */
    String pipeCloseFlow(PipeQueryVo queryVo);

    /**
     * 管网漏损-演示
     * @param queryVo
     * @return
     */
    List<PipeMarkerVo> pipeFlowLeakage(PipeQueryVo queryVo);
}
